﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DefaultHT.Master" CodeBehind="Payments.aspx.cs"
    Inherits="Hotel.Operations.Payments" Theme="Theme1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <link rel="stylesheet" href="../Styles/Main.css" type="text/css" />
    <link rel="stylesheet" href="../Scripts/css/jquery.ui.all.css" type="text/css">
    <link rel="stylesheet" href="../Scripts/css/jquery.ui.theme.css" type="text/css">
    <script src="../Scripts/jquery-1.8.2.js"></script>
    <script src="../Scripts/jquery-1.4.1.min.js"></script>
    <script src="../Scripts/jquery.ui.core.js"></script>
    <script src="../Scripts/jquery.ui.widget.js"></script>
    <script src="../Scripts/jquery.ui.datepicker.js"></script>
    <link rel="stylesheet" href="../Scripts/css/demos.css" type="text/css">
       <script>
           //$(function () {
           //    //$("#txtStartDate").datepicker();
           //    //   $(".datepicker").datepicker();
           //    $("input[id$='StartDateTxtBox']").datepicker();
           //    $("input[id$='EndDateTxtBox']").datepicker();

           //})


           $(function () {
               $("input[id$='StartDateTxtBox']").datepicker({
                   // defaultDate: "+1w",
                   changeYear: true,
                   changeMonth: true,
                   // numberOfMonths: 3,
                   onSelect: function (selectedDate) {
                       $("input[id$='EndDateTxtBox']").datepicker("option", "minDate", selectedDate);
                   }
               });
               $("input[id$='EndDateTxtBox']").datepicker({
                   // defaultDate: "+1w",
                   changeMonth: true,
                   changeYear: true,
                   //numberOfMonths: 3,
                   onSelect: function (selectedDate) {
                       $("input[id$='StartDateTxtBox']").datepicker("option", "maxDate", selectedDate);
                   }
               });
               $(".date").datepicker({
                   // defaultDate: "+1w",
                   changeMonth: true,
                   changeYear: true,
                   //numberOfMonths: 3,
                   onSelect: function (selectedDate) { }
                    
                   });
               $("input[id$='btnSubmit']").click(function () {
                   var sDate = Date.parse($("input[id$='StartDateTxtBox']").val());
                   var eDate = Date.parse($("input[id$='EndDateTxtBox']").val());
                   if (sDate > eDate) {
                       alert('start date cannot be greater than end date');
                       return false;
                   }

               });



           });
           </script>
    <div style="height: 30px; padding: 10px 10px 10px 10px;">
		<h2>Payments</h2>
        
	</div>
        <div style="text-align: center;padding-left:10px;">
    <asp:Table runat="server" ID="tableSearch">
        <asp:TableRow>
            <asp:TableCell>
                Payment Mode

            </asp:TableCell>
            <asp:TableCell>
                <asp:DropDownList ID="PaymentModeDropDownList" runat="server" Width="100" CssClass="dropdown"></asp:DropDownList>
            </asp:TableCell>
            <asp:TableCell>Payment Cleared</asp:TableCell>

            <asp:TableCell>
                <asp:DropDownList ID="PaymentClearedDropDownList" runat="server" CssClass="dropdown" Width="70">
                    <asp:ListItem Text="" Value=""></asp:ListItem>
                    <asp:ListItem Text="Yes" Value="0"></asp:ListItem>
                    <asp:ListItem Text="No" Value="1"></asp:ListItem>
                </asp:DropDownList>
            </asp:TableCell>

            <asp:TableCell>Start Date</asp:TableCell>
            <asp:TableCell>
                <div class="demo">
                <asp:TextBox ID="StartDateTxtBox" runat="server" CssClass="textbox"></asp:TextBox></div>
            </asp:TableCell>

            <asp:TableCell>End Date</asp:TableCell>

            <asp:TableCell>
                 <div class="demo">
                <asp:TextBox ID="EndDateTxtBox" runat="server" CssClass="textbox"></asp:TextBox></div>
            </asp:TableCell>
            <asp:TableCell>
                <asp:Button ID="btnSearch" runat="server" Text="Go" OnClick="btnSearch_Click " />
            </asp:TableCell>
        </asp:TableRow>

    </asp:Table>

        <div>


            <asp:GridView ID="gvPayments" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="PaymentId" CssClass="grid" AlternatingRowStyle-CssClass="gridAltRow"
        RowStyle-CssClass="gridRow" EditRowStyle-CssClass="gridEditRow" 
                 OnRowEditing="gvPaments_RowEditing" OnRowUpdating="gvPayments_RowUpdating" OnRowDataBound="gvpayment_RowDataBound" OnRowCancelingEdit="gvpaymentl_RowCancelingEdit">
<AlternatingRowStyle CssClass="gridAltRow"></AlternatingRowStyle>
                <Columns>
                   
                  <asp:TemplateField HeaderText="Payment Description">
                      <ItemTemplate><asp:Label ID="lbldescription" runat="server" Text='<%# Eval("PaymentDescription") %>'></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:TextBox ID="txtdescription" CssClass="textbox" runat="server" Text='<%# Eval("PaymentDescription") %>'></asp:TextBox></EditItemTemplate>
                  </asp:TemplateField>
                    <asp:TemplateField HeaderText="Payment Date">
                      <ItemTemplate><asp:Label ID="lblpaymentDate" runat="server" Text='<%# Eval("PaymentDate","{0:d}") %>'></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:TextBox ID="txtpaymentDate" CssClass="textbox  date" runat="server" Text='<%# Eval("PaymentDate","{0:d}") %>'></asp:TextBox>
                           <asp:RequiredFieldValidator ID="rftxtDate" runat="server" ControlToValidate="txtpaymentDate" ErrorMessage="Payment Date is required." ValidationGroup="Update" Display="None"></asp:RequiredFieldValidator>

                      </EditItemTemplate>
                  </asp:TemplateField>
                    <asp:TemplateField HeaderText="Amount">
                      <ItemTemplate><asp:Label ID="lblAmount" runat="server" Text='<%# Eval("Amount","{0:n2}") %>'></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:TextBox ID="txtAmount"  CssClass="textbox" runat="server" Text='<%# Eval("Amount","{0:n2}") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rftxtAmounte" runat="server" ControlToValidate="txtAmount" ErrorMessage="Amount is required." ValidationGroup="Update" Display="None"></asp:RequiredFieldValidator>
                      </EditItemTemplate>
                        <ItemStyle   HorizontalAlign="Right"></ItemStyle>
                  </asp:TemplateField>
                   <asp:TemplateField HeaderText="Surcharge">
                      <ItemTemplate><asp:Label ID="lblSurcharge" runat="server" Text='<%# Eval("Surcharge") %>'></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:TextBox ID="txtSurcharge" CssClass="textbox" runat="server" Text='<%# Eval("Surcharge","{0:n2}") %>' ></asp:TextBox></EditItemTemplate>
                       <ItemStyle   HorizontalAlign="Right"></ItemStyle>
                  </asp:TemplateField>
                    <asp:TemplateField HeaderText="Payment Cleared">
                      <ItemTemplate><asp:Label ID="lblClearanceFlag" runat="server" Text=' <%# string.IsNullOrEmpty(Eval("ClearanceFlag").ToString())?"": Convert.ToBoolean(Eval("ClearanceFlag"))?"No":"Yes" %>' Enabled="false"></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:DropDownList ID="PaymentClearedDropDownList" runat="server" CssClass="dropdown" Width="50">
                    <asp:ListItem Text="Yes" Value="0"></asp:ListItem>
                    <asp:ListItem Text="No" Value="1"></asp:ListItem>
                </asp:DropDownList>

                            <asp:Label ID="lblvalue" runat="server" Text='<%# Convert.ToBoolean(Eval("ClearanceFlag"))?"No":"Yes" %>'
                    Visible="false"></asp:Label>
                      </EditItemTemplate>
                        <ItemStyle  HorizontalAlign="Center"/>
                  </asp:TemplateField>
                    <asp:TemplateField HeaderText="Remarks">
                      <ItemTemplate><asp:Label ID="lblRemarks" runat="server" Text='<%# Eval("Remarks") %>'></asp:Label></ItemTemplate>
                      <EditItemTemplate><asp:TextBox ID="txtRemarks" runat="server" Text='<%# Eval("Remarks") %>' CssClass="textbox"></asp:TextBox></EditItemTemplate>
                  </asp:TemplateField>
                <asp:TemplateField HeaderText="" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                        <EditItemTemplate>
                            <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update"
                                Text="Update" OnClientClick="return confirm('Update?')" ValidationGroup="Update"></asp:LinkButton>
                            <asp:ValidationSummary ID="vsUpdate" runat="server" ShowMessageBox="true" ShowSummary="false"
                                ValidationGroup="Update" Enabled="true" HeaderText="" />
                            <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="Cancel"></asp:LinkButton>
                        </EditItemTemplate>
                         
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="Edit"></asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Left" />
                          <FooterStyle  HorizontalAlign="Left" VerticalAlign="Top"/>
                    </asp:TemplateField>
                 
                   </Columns>

<EditRowStyle CssClass="gridEditRow"></EditRowStyle>

<RowStyle CssClass="gridRow"></RowStyle>
                <EmptyDataTemplate>
                    No Data Found.
                </EmptyDataTemplate>
            </asp:GridView>
          
        </div>

            </div>
</asp:Content>

